from django.core.management import call_command
from project.travel_game.models import *
from django.core.files.uploadedfile import SimpleUploadedFile

call_command('syncdb')

f=SimpleUploadedFile('oxen.png',open('static_media/images/oregon_trail/oxen.png','r').read())
oxItem = AbstractItem(name='Two Oxen',description='A yoke of oxen',weight=0,cost=40,image=f)
oxItem.save()
f.close()
f=SimpleUploadedFile('food.png',open('static_media/images/oregon_trail/food.png','r').read())
foodItem = AbstractItem(name='Food',description='1 pounds of food',weight=1,cost=.2,image=f)
foodItem.save()
f.close()
f=SimpleUploadedFile('clothing.png',open('static_media/images/oregon_trail/clothing.png','r').read())
clothingItem = AbstractItem(name='Clothing',description='1 set of clothing (for 1 person)',weight=2,cost=10,image=f)
clothingItem.save()
f.close()
f=SimpleUploadedFile('ammo.png',open('static_media/images/oregon_trail/ammo.png','r').read())
ammoItem = AbstractItem(name='Ammo',description='A box of ammo (20 rounds)',weight=3,cost=2,image=f)
ammoItem.save()
f.close()
f=SimpleUploadedFile('wagonWheel.png',open('static_media/images/oregon_trail/wagonWheel.png','r').read())
wheelItem = AbstractItem(name='Wagon wheel',description='Replacement wagon wheel',weight=75,cost=10,image=f)
wheelItem.save()
f.close()
f=SimpleUploadedFile('wagonTongue.png',open('static_media/images/oregon_trail/wagonTongue.png','r').read())
tongueItem = AbstractItem(name='Wagon tongue',description='Tongue to attach oxen to',weight=100,cost=10,image=f)
tongueItem.save()
f.close()
f=SimpleUploadedFile('wagonAxle.png',open('static_media/images/oregon_trail/wagonAxle.png','r').read())
axleItem = AbstractItem(name='Wagon axle',description='A replacement wagon axle',weight=125,cost=10,image=f)
axleItem.save()
f.close()

prof = Profession(name="Banker",description="Starts with more money",startingMoney=1600)
prof.save()
prof = Profession(name="Farmer",description="Less starting money, oxen have more health",startingMoney=400)
prof.save()
prof = Profession(name="Carpenter",description="Can repair wagons easier, average starting money",startingMoney=800)
prof.save()

f=SimpleUploadedFile('independence.png',open('static_media/images/oregon_trail/independence.png','r').read())
indLandmark = FortTown(distanceFromStart=0,name='Independence',image=f,costModifier=1.0)
indLandmark.save()
f.close()

newAbStore = AbstractStore(location=indLandmark,name='Independence Store')
newAbStore.save()

oxItem1 = Item(itemType=oxItem,holder=newAbStore,quantity=100)
oxItem1.save()
foodItem1 = Item(itemType=foodItem,holder=newAbStore,quantity=5000)
foodItem1.save()
clothingItem1 = Item(itemType=clothingItem,holder=newAbStore,quantity=1000)
clothingItem1.save()
ammoItem1 = Item(itemType=ammoItem,holder=newAbStore,quantity=5000)
ammoItem1.save()
wheelItem1 = Item(itemType=wheelItem,holder=newAbStore,quantity=100)
wheelItem1.save()
tongueItem1 = Item(itemType=tongueItem,holder=newAbStore,quantity=100)
tongueItem1.save()
axleItem1 = Item(itemType=axleItem,holder=newAbStore,quantity=100)
axleItem1.save()

f=SimpleUploadedFile('ftKearney.png',open('static_media/images/oregon_trail/ftKearney.png','r').read())
indLandmark = FortTown(distanceFromStart=304,name='Fort Kearney',image=f,costModifier=1.1)
indLandmark.save()
f.close()

newAbStore = AbstractStore(location=indLandmark,name='Fort Kearney Store')
newAbStore.save()

oxItem1 = Item(itemType=oxItem,holder=newAbStore,quantity=100)
oxItem1.save()
foodItem1 = Item(itemType=foodItem,holder=newAbStore,quantity=5000)
foodItem1.save()
clothingItem1 = Item(itemType=clothingItem,holder=newAbStore,quantity=1000)
clothingItem1.save()
ammoItem1 = Item(itemType=ammoItem,holder=newAbStore,quantity=5000)
ammoItem1.save()
wheelItem1 = Item(itemType=wheelItem,holder=newAbStore,quantity=100)
wheelItem1.save()
tongueItem1 = Item(itemType=tongueItem,holder=newAbStore,quantity=100)
tongueItem1.save()
axleItem1 = Item(itemType=axleItem,holder=newAbStore,quantity=100)
axleItem1.save()

f=SimpleUploadedFile('chimneyrock.png',open('static_media/images/oregon_trail/chimneyRock.png','r').read())
indLandmark = FortTown(distanceFromStart=554,name='Chimney Rock',image=f) 
indLandmark.save()
f.close()

f=SimpleUploadedFile('ftLaramie.png',open('static_media/images/oregon_trail/ftLaramie.png','r').read())
indLandmark = FortTown(distanceFromStart=640,name='Fort Laramie',image=f,costModifier=1.2)
indLandmark.save()
f.close()

newAbStore = AbstractStore(location=indLandmark,name='Fort Laramie Store')
newAbStore.save()

oxItem1 = Item(itemType=oxItem,holder=newAbStore,quantity=100)
oxItem1.save()
foodItem1 = Item(itemType=foodItem,holder=newAbStore,quantity=5000)
foodItem1.save()
clothingItem1 = Item(itemType=clothingItem,holder=newAbStore,quantity=1000)
clothingItem1.save()
ammoItem1 = Item(itemType=ammoItem,holder=newAbStore,quantity=5000)
ammoItem1.save()
wheelItem1 = Item(itemType=wheelItem,holder=newAbStore,quantity=100)
wheelItem1.save()
tongueItem1 = Item(itemType=tongueItem,holder=newAbStore,quantity=100)
tongueItem1.save()
axleItem1 = Item(itemType=axleItem,holder=newAbStore,quantity=100)
axleItem1.save()

f=SimpleUploadedFile('independenceRock.png',open('static_media/images/oregon_trail/independenceRock.png','r').read())
indLandmark = FortTown(distanceFromStart=830,name='Independence Rock',image=f)
indLandmark.save()
f.close()

f=SimpleUploadedFile('southPass.png',open('static_media/images/oregon_trail/southPass.png','r').read())
indLandmark = FortTown(distanceFromStart=932,name='South Pass',image=f)
indLandmark.save()
f.close()

#f=SimpleUploadedFile('ftBridger.png',open('static_media/images/oregon_trail/ftBridger.png','r').read())  #optional route
#indLandmark = FortTown(distanceFromStart=955,name='Fort Bridger',image=f,costModifier=1.3)
#indLandmark.save()
#f.close()

#newAbStore = AbstractStore(location=indLandmark,name='Fort Bridger Store')
#newAbStore.save()

#oxItem1 = Item(itemType=oxItem,holder=newAbStore,quantity=100)
#oxItem1.save()
#foodItem1 = Item(itemType=foodItem,holder=newAbStore,quantity=5000)
#foodItem1.save()
#clothingItem1 = Item(itemType=clothingItem,holder=newAbStore,quantity=1000)
#clothingItem1.save()
#ammoItem1 = Item(itemType=ammoItem,holder=newAbStore,quantity=5000)
#ammoItem1.save()
#wheelItem1 = Item(itemType=wheelItem,holder=newAbStore,quantity=100)
#wheelItem1.save()
#tongueItem1 = Item(itemType=tongueItem,holder=newAbStore,quantity=100)
#tongueItem1.save()
#axleItem1 = Item(itemType=axleItem,holder=newAbStore,quantity=100)
#axleItem1.save()

f=SimpleUploadedFile('sodaSprings.png',open('static_media/images/oregon_trail/sodaSprings.png','r').read())
indLandmark = FortTown(distanceFromStart=1094,name='Soda Springs',image=f)   #if optional route taken, distanceFromStart=1117
indLandmark.save()
f.close()

f=SimpleUploadedFile('ftHall.png',open('static_media/images/oregon_trail/ftHall.png','r').read())
indLandmark = FortTown(distanceFromStart=1151,name='Fort Hall',image=f,costModifier=1.3)   #if optional route taken, distanceFromStart=1174 and costModifier=1.4
indLandmark.save()
f.close()

newAbStore = AbstractStore(location=indLandmark,name='Fort Hall Store')
newAbStore.save()

oxItem1 = Item(itemType=oxItem,holder=newAbStore,quantity=100)
oxItem1.save()
foodItem1 = Item(itemType=foodItem,holder=newAbStore,quantity=5000)
foodItem1.save()
clothingItem1 = Item(itemType=clothingItem,holder=newAbStore,quantity=1000)
clothingItem1.save()
ammoItem1 = Item(itemType=ammoItem,holder=newAbStore,quantity=5000)
ammoItem1.save()
wheelItem1 = Item(itemType=wheelItem,holder=newAbStore,quantity=100)
wheelItem1.save()
tongueItem1 = Item(itemType=tongueItem,holder=newAbStore,quantity=100)
tongueItem1.save()
axleItem1 = Item(itemType=axleItem,holder=newAbStore,quantity=100)
axleItem1.save()

f=SimpleUploadedFile('ftBoise.png',open('static_media/images/oregon_trail/ftBoise.png','r').read())
indLandmark = FortTown(distanceFromStart=1447,name='Fort Boise',image=f,costModifier=1.4)   #if optional route taken, distanceFromStart=1470 and costModifier=1.5
indLandmark.save()
f.close()

newAbStore = AbstractStore(location=indLandmark,name='Fort Boise Store')
newAbStore.save()

oxItem1 = Item(itemType=oxItem,holder=newAbStore,quantity=100)
oxItem1.save()
foodItem1 = Item(itemType=foodItem,holder=newAbStore,quantity=5000)
foodItem1.save()
clothingItem1 = Item(itemType=clothingItem,holder=newAbStore,quantity=1000)
clothingItem1.save()
ammoItem1 = Item(itemType=ammoItem,holder=newAbStore,quantity=5000)
ammoItem1.save()
wheelItem1 = Item(itemType=wheelItem,holder=newAbStore,quantity=100)
wheelItem1.save()
tongueItem1 = Item(itemType=tongueItem,holder=newAbStore,quantity=100)
tongueItem1.save()
axleItem1 = Item(itemType=axleItem,holder=newAbStore,quantity=100)
axleItem1.save()

f=SimpleUploadedFile('blueMountains.png',open('static_media/images/oregon_trail/blueMountains.png','r').read())
indLandmark = FortTown(distanceFromStart=1609,name='Blue Mountains',image=f)   #if optional route taken, distanceFromStart=1632
indLandmark.save()
f.close()

f=SimpleUploadedFile('ftWallaWalla.png',open('static_media/images/oregon_trail/ftWallaWalla.png','r').read())
indLandmark = FortTown(distanceFromStart=1664,name='Fort Walla Walla',image=f,costModifier=1.5)   #if optional route taken, distanceFromStart=1697 and costModifier=1.6
indLandmark.save()
f.close()

newAbStore = AbstractStore(location=indLandmark,name='Fort Walla Walla')
newAbStore.save()

oxItem1 = Item(itemType=oxItem,holder=newAbStore,quantity=100)
oxItem1.save()
foodItem1 = Item(itemType=foodItem,holder=newAbStore,quantity=5000)
foodItem1.save()
clothingItem1 = Item(itemType=clothingItem,holder=newAbStore,quantity=1000)
clothingItem1.save()
ammoItem1 = Item(itemType=ammoItem,holder=newAbStore,quantity=5000)
ammoItem1.save()
wheelItem1 = Item(itemType=wheelItem,holder=newAbStore,quantity=100)
wheelItem1.save()
tongueItem1 = Item(itemType=tongueItem,holder=newAbStore,quantity=100)
tongueItem1.save()
axleItem1 = Item(itemType=axleItem,holder=newAbStore,quantity=100)
axleItem1.save()

f=SimpleUploadedFile('dalles.png',open('static_media/images/oregon_trail/dalles.png','r').read())
indLandmark = FortTown(distanceFromStart=1784,name='Dalles',image=f)   #if optional route taken, distanceFromStart=1807
indLandmark.save()
f.close()

f=SimpleUploadedFile('columbiaRiver.png',open('static_media/images/oregon_trail/columbiaRiver.png','r').read())
indLandmark = Landmark(distanceFromStart=1900,name='END',image=f)  #1900 is arbitrary
indLandmark.save()
f.close()

f=SimpleUploadedFile('kansasRiver.png',open('static_media/images/oregon_trail/kansasRiver.png','r').read())
river = River(distanceFromStart=102,name='Kansas River',ferry=True,minDepth=6,maxDepth=10,image=f,currentDepth=6)
river.save()
f.close()

f=SimpleUploadedFile('bigBlueRiver.png',open('static_media/images/oregon_trail/bigBlueRiver.png','r').read())
river = River(distanceFromStart=185,name='Big Blue River',ferry=False,minDepth=2,maxDepth=4,currentDepth=2,image=f)
river.save()
f.close()

f=SimpleUploadedFile('snakeRiver.png',open('static_media/images/oregon_trail/snakeRiver.png','r').read())
river = River(distanceFromStart=1333,name='Snake River',ferry=False,minDepth=4,maxDepth=8,currentDepth=4,image=f) # 1356 if other path chosen
river.save()
f.close()